	<div class="page-header">
		<h3> 카테고리</h3>
	</div>

	<div class="table-responsive" style="padding: 8px 0;">
		<div class="container col-md-6" style="height: 400px;overflow-y: scroll;">
			<table class="table table-condensed borderless tree tree-hover">

			<?php foreach ($category_tree as $row_data): ?>
				<?php if ( $row_data->depth <=  $category_depth_limit): ?>
					<?php if ( $row_data->depth == 0 and $row_data->category_code === '0' ): ?>
						<tr class="treegrid-<?=$row_data->category_code?>">
							<td>
								<input type="hidden" id="category_depth_limit" name="category_depth_limit" value="<?=$category_depth_limit?>" />
								<input type="hidden" name="category_code" value="<?=$row_data->category_code?>" />
								<input type="hidden" name="parent_category_code" value="<?=$row_data->parent_category_code?>" />
								<input type="hidden" name="category_name_pc" value="<?=$row_data->category_name_pc?>" />
								<input type="hidden" name="display_order" value="<?=$row_data->display_order?>" />
								<input type="hidden" name="commodity_count_pc" value="<?=$row_data->commodity_count_pc?>" />
								<input type="hidden" name="depth" value="<?=$row_data->depth?>" />
								<?=$row_data->category_name_pc?>
							</td>
							<td style="width: 100px;"></td>
						</tr>
					<?php else: ?>
						<tr class="treegrid-<?=$row_data->category_code?> treegrid-parent-<?=$row_data->parent_category_code?>">
							<td>
								<input type="hidden" name="category_code" value="<?=$row_data->category_code?>" />
								<input type="hidden" name="parent_category_code" value="<?=$row_data->parent_category_code?>" />
								<input type="hidden" name="category_name_pc" value="<?=$row_data->category_name_pc?>" />
								<input type="hidden" name="display_order" value="<?=$row_data->display_order?>" />
								<input type="hidden" name="commodity_count_pc" value="<?=$row_data->commodity_count_pc?>" />
								<input type="hidden" name="depth" value="<?=$row_data->depth?>" />
								<?=$row_data->category_code?>:<?=$row_data->category_name_pc?>
								<span class="badge pull-right"><?=$row_data->commodity_count_pc?></span>
							</td>
							<td style="width: 100px;"></td>
						</tr>
					<?php endif; ?>
				<?php endif; ?>
			<?php endforeach; ?>
			</table>
		</div>
		<div class="col-md-6">
			<div class="col-md-12">
				<div class="panel panel-default" id="insert_update_panel">
					<div class="panel-heading">
						<h3 class="panel-title"><strong>카테고리&nbsp;&nbsp;등록&nbsp;/&nbsp;수정</strong></h3>
					</div>
					<div class="panel-body">
						<form method="post" class="form-horizontal" role="form" name="insertUpdateForm" action="<?=base_url() . 'index.php/admin/category/'; ?>">
							<div class="form-group text-left has-error" id="insert_update_message"></div>
							<input type="hidden" id="inputBeforeParentCategoryCode" name="before_parent_category_code" value="<?php echo set_value('before_parent_category_code'); ?>" disabled>
							<div class="form-group" id="insert_update_field_1">
								<label for="inputEmail1" class="col-lg-3 control-label">상위 카테고리</label>
								<div class="col-lg-9">
									<select class="form-control input-sm" id="inputParentCategoryCode" name="parent_category_code" disabled>
										<option value="" <?php echo set_select('parent_category_code', '', TRUE); ?>>----&nbsp;&nbsp;상위 카테고리&nbsp;&nbsp;----</option>
										<?php foreach ($category_tree as $row_data): ?>
											<?php if ( $row_data->depth <=  $category_depth_limit): ?>
												<option value="<?=$row_data->category_code?>" <?php echo set_select('parent_category_code', $row_data->category_code); ?>>
													<?php
														$depthStr = '';
														for ($i = 1; $i < $row_data->depth; $i++) {
															$depthStr .= '&nbsp;&nbsp;&nbsp;&nbsp;';
														}

														if ($row_data->depth == 0) {
															echo $depthStr . $row_data->category_name_pc;
														} else {
															echo $depthStr . $row_data->category_code . ':' . $row_data->category_name_pc;
														}
													?>
												</option>
											<?php endif; ?>
										<?php endforeach; ?>
									</select>
								</div>
							</div>
							<div class="form-group" id="insert_update_field_2">
								<label for="inputCategoryCode" class="col-lg-3 control-label">카테고리 코드</label>
								<div class="col-lg-9">
									<input type="text" class="form-control input-sm disabled" id="inputCategoryCode" name="category_code" value="<?php echo set_value('category_code'); ?>" maxlength="16" placeholder="카테고리 코드" disabled>
								</div>
							</div>
							<div class="form-group" id="insert_update_field_3">
								<label for="inputCategoryNamePc" class="col-lg-3 control-label">카테고리 명</label>
								<div class="col-lg-9">
									<input type="text" class="form-control input-sm" id="inputCategoryNamePc" name="category_name_pc" value="<?php echo set_value('category_name_pc'); ?>" maxlength="20" placeholder="카테고리 명" disabled>
								</div>
							</div>
							<div class="form-group">
								<div class="col-lg-offset-3 col-lg-9 text-right">
									<button type="button" id="insertSubmitBtn" class="btn btn-primary btn-sm disabled">등록</button>
									<button type="button" id="updateSubmitBtn" class="btn btn-primary btn-sm disabled">수정</button>
								</div>
							</div>
							<div class="form-group">
								<div class="col-lg-offset-3 col-lg-9 text-right">
									<button type="button" id="addBtn" class="btn btn-success btn-sm">Add</button>
									<button type="button" id="modBtn" class="btn btn-info btn-sm">Mod</button>
									<button type="button" id="delBtn" class="btn btn-danger btn-sm">Del</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
			<div class="col-md-12">
				<div class="panel panel-default" id="priority_panel">
					<div class="panel-heading">
						<h3 class="panel-title"><strong>카테고리&nbsp;&nbsp;순서</strong></h3>

					</div>
					<div class="panel-body">
						<form method="post" role="form" name="priorityForm" action="<?=base_url() . 'index.php/admin/category/change_priority'; ?>">
							<div class="form-group has-error" id="priority_message"></div>
							<div class="form-group" id="priority_field">
								<table class="table table-condensed">
									<thead>
										<tr>
											<th>카테고리</th><th style="width: 100px;">순위</th>
										</tr>
									</thead>
									<tbody></tbody>
								</table>
							</div>
							<div class="form-group text-right">
								<!-- <input type="hidden" name="parent_category_code" value="<?php echo set_value('parent_category_code'); ?>"> -->
								<button type="button" id="prioritySubmitBtn" class="btn btn-primary btn-sm disabled">변경</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>

